home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilmisc / maestix.lha / Maestix / demos / Realtime.s < prev    next >
Text File  |  1995-03-29  |  4KB  |  129 lines

  1. *****************************************************************
  2. *                                *
  3. *    maestix.library-Demo:    Realtime FX            *
  4. *                                *
  5. *****************************************************************
  6. *
  7. *    Programmed by        Richard Körber
  8. *    Date            1995-03-27
  9. *
  10. *****************************************************************
  11. *  This  demonstration  shows  the  realtime effect feature of  *
  12. *  the  maestix library.   It allocates the  Maestro soundcard  *
  13. *  and switches to realtime effect.                *
  14. *****************************************************************
  15.  
  16.         INCDIR    "include:"
  17.         INCLUDE    exec.i            ; Library call macros
  18.         INCLUDE    intuition.i
  19.         INCLUDE    graphics.i
  20.         INCLUDE    dos.i
  21.         INCLUDE    maestix.i
  22.         INCLUDE    libraries/maestix.i    ;Reference includes
  23.         INCLUDE    intuition/intuition.i
  24.         INCLUDE    dos/dostags.i
  25.         INCLUDE    exec/ports.i
  26.  
  27.         SECTION text,CODE
  28.  
  29. *---------------------------------------------------------------*
  30. *    == START OF PROGRAM ==                    *
  31. *                                *
  32. start    ;-- Open all libraries -----------------;
  33.         lea    maestname(PC),a1    ;maestix
  34.         moveq    #38,d0            ; V38+
  35.         exec    OpenLibrary        ; open
  36.         move.l    d0,maestbase        ; store base
  37.         beq    error1            ; not found!
  38.         lea    intuiname(PC),a1    ;intuition
  39.         moveq    #36,d0            ; V36+
  40.         exec    OpenLibrary        ; open
  41.         move.l    d0,intuibase        ; store base
  42.         beq    error2
  43.     ;-- Allocate Maestro -------------------;
  44.         sub.l    a0,a0            ;no tags
  45.         maest    AllocMaestro
  46.         move.l    d0,maestro        ;^Maestro base
  47.         beq    error3
  48.     ;-- Set Modus --------------------------;
  49.         move.l    maestro(PC),a0        ;^Maestro base
  50.         lea    modustags(PC),a1    ;^Modus tags
  51.         maest    SetMaestro        ;set it now
  52.         move.l    maestro(PC),a0        ;^Maestro base
  53.         lea    realtags(PC),a1
  54.         maest    StartRealtime
  55.     ;-- Open a window ----------------------;
  56.         sub.l    a0,a0            ;no newwindow struct
  57.         lea    windowtags(PC),a1    ; but loads of tags
  58.         intui    OpenWindowTagList
  59.         move.l    d0,window
  60.         beq    error4
  61.     ;-- Wait for reply (main loop) ---------;
  62. .mainloop    move.l    window(PC),a0        ;window message?
  63.         move.l    wd_UserPort(a0),a0    ; ^message port
  64.         exec    WaitPort
  65. .nextmsg    move.l    window(PC),a0        ;window message?
  66.         move.l    wd_UserPort(a0),a0    ; ^message port
  67.         exec    GetMsg            ; try to get it...
  68.         tst.l    d0            ; got one?
  69.         beq.b    .mainloop        ; nope: wait for next msg
  70.     ;---- got a window event ---------------;
  71.         move.l    d0,a0            ;^IDCMP-message -> a0
  72.         cmp.l    #IDCMP_CLOSEWINDOW,im_Class(a0) ;close window?
  73.         bne.b    .nextmsg        ; no -> look for next msg
  74.     ;-- Exit program -----------------------;
  75. exit        move.l    window(PC),a0        ;Close output window
  76.         intui    CloseWindow
  77. error4        move.l    maestro(PC),a0        ;Stop realtime
  78.         maest    StopRealtime
  79.         move.l    maestro(PC),a0        ;Set maestro free
  80.         maest    FreeMaestro
  81. error3        move.l    intuibase(PC),a1    ;close intuition library
  82.         exec    CloseLibrary
  83. error2        move.l    maestbase(PC),a1    ;close maestix library
  84.         exec    CloseLibrary
  85. error1        moveq    #0,d0            ;Reply 0
  86.         rts                ;back to CLI
  87.  
  88. *---------------------------------------------------------------*
  89. *    == DATA SECTION ==                    *
  90. *                                *
  91. maestbase    dc.l    0            ;^Maestix Lib Base
  92. intuibase    dc.l    0            ;^Intuition Lib Base
  93. maestro        dc.l    0            ;^Maestro Base
  94. window        dc.l    0            ;^Window structure
  95.  
  96. modustags    dc.l    MTAG_Output,OUTPUT_FIFO  ;Input -> Output
  97.         dc.l    MTAG_Input,INPUT_STD     ;Custom input
  98.         dc.l    MTAG_CopyProh,CPROH_OFF  ;No copy protection
  99.         dc.l    MTAG_Emphasis,EMPH_INPUT ;Emphasis see input
  100.         dc.l    MTAG_Source,SRC_INPUT     ;Source see input
  101.         dc.l    MTAG_Rate,RATE_INPUT     ;Rate see input
  102.         dc.l    TAG_DONE
  103.  
  104. realtags    dc.l    MTAG_Effect,RFX_Spatial    ;shift the speakers...
  105.         dc.l    MTAG_D2,64
  106.         dc.l    TAG_DONE
  107.  
  108. windowtags    dc.l    WA_IDCMP,IDCMP_CLOSEWINDOW ;<- New window's tags
  109.         dc.l    WA_Title,.title
  110.         dc.l    WA_InnerWidth,150
  111.         dc.l    WA_InnerHeight,0
  112.         dc.l    WA_DragBar,-1
  113.         dc.l    WA_DepthGadget,-1
  114.         dc.l    WA_CloseGadget,-1
  115.         dc.l    WA_Activate,-1
  116.         dc.l    WA_RMBTrap,-1
  117.         dc.l    TAG_DONE
  118. .title        dc.b    "Realtime FX",0
  119.         even
  120.  
  121. maestname    dc.b    "maestix.library",0    ;Maestix name
  122. intuiname    dc.b    "intuition.library",0    ;Intuition name
  123.         even
  124.  
  125. *---------------------------------------------------------------*
  126. *    == END ==                        *
  127. *                                *
  128.         END
  129.